home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BMUG Revelations
/
BMUG Revelations.toast
/
Programming
/
Programming Utilities
/
ViewIt Shareware
/
ViewIt™ 2.04 Shareware
/
Projects
/
Pascal Demos
/
FaceProcLP.pas
next >
Wrap
Pascal/Delphi Source File
|
1992-06-24
|
3KB
|
122 lines
{FaceWare 2.0 Initialization & Dispatching Procedures}
{©FaceWare 1989-92. All Rights Reserved.}
unit FaceProcLP;
interface
uses
FaceStorLP;
type
HeadRec = record
addr: ProcPtr;
baseID: integer;
versID: integer;
message: integer;
resID: integer;
fPtr: Ptr;
end;
HeadPtr = ^HeadRec;
var
fRec: FaceRec;
procedure FaceIt (thePtr: univ Ptr; m1, m2, m3, m4, m5: longint);
implementation
procedure PrepIt (x, b, v, r, f: longint);
var
i: integer;
begin
with HeadPtr(x)^ do
begin
addr := GetResource('FCMD', 1000)^;
baseID := b;
versID := v;
message := 0;
resID := r;
fPtr := pointer(f);
with fRec do
if (xEntries > 0) then
for i := 0 to xEntries - 1 do
if (baseID = xTable[1 + i * 4]) then
if (versID = xTable[2 + i * 4]) then
if (xTable[4 + i * 4] <> 0) then
addr := ProcPtr(xTable[4 + i * 4]);
end;
end;
procedure JumpIt (thePtr: Ptr);
inline
$2257, $2051, $4E90;
procedure FaceIt;
var
i: integer;
begin
with fRec do
begin
if (m1 = DoInit) then
begin
if (m4 > -1) and not BitTst(@m4, 31) then
begin
FlushEvents(62, 0); {ignore spurious mouse and key events}
InitGraf(@thePort); {perform appropriate Mac initializations}
InitFonts;
InitWindows;
InitMenus;
TEInit;
InitDialogs(nil);
end;
if (GetResource('FCMD', 1000) = nil) then {LoadIt available?}
if (OpenResFile(StringPtr(StripAddress(@uName))^) < 0) then
ExitToShell; {quit if not found}
fFlags := m2; {store FaceIt bit flags}
xEntries := m5; {store # of table entries}
thePtr := @fRec;
if (m3 > -1) then {call LoadIt to expand heap?}
begin
PrepIt(ord(thePtr), m3, 0, 0, ord(thePtr));
JumpIt(thePtr);
end;
PrepIt(ord(thePtr), 1100, 20, 0, ord(thePtr)); {setup fRec header}
PrepIt(ord(@dHead), 1130, 10, 0, ord(thePtr)); {setup dRec header}
PrepIt(ord(@uHead), 1110, 20, 0, ord(thePtr)); {setup uRec header}
PrepIt(ord(@vHead), 1200, 20, 0, ord(thePtr)); {setup vRec header}
fHead[6] := m4; {store environment type}
uHead[6] := 0; {store string type}
thePtr := nil;
if (m4 < -3) then
exit(FaceIt);
end;
if (m1 = DoPrep) then
PrepIt(m2, m3, m4, m5, ord(@fRec))
else if (m1 < 0) and (m1 > -11) then
begin
i := (4 * (-1 - m1));
xTable[1 + i] := m2;
xTable[2 + i] := m3;
xTable[3 + i] := m4;
xTable[4 + i] := m5;
end
else
begin
if (thePtr = nil) then {call to the default module?}
thePtr := @uHead
else if (HeadPtr(thePtr)^.fPtr <> @fRec) then
begin {call to a control driver?}
cControl := pointer(thePtr);
thePtr := @vHead;
end;
HeadPtr(thePtr)^.message := 0;
uCommand := m1; {pass Command & Params}
uParam[1] := m2;
uParam[2] := m3;
uParam[3] := m4;
uParam[4] := m5;
JumpIt(thePtr); {jump to FCMD module}
end;
end;
end;
end.